Conversation
|
With these changes, I think that #513 should consistently fail. |
cfgrammar/src/lib/yacc/mod.rs
Outdated
| YaccKind::Grmtools => quote!(::cfgrammar::yacc::YaccKind::Grmtools), | ||
| YaccKind::Original(action_kind) => { | ||
| quote!(::cfgrammar::yacc::YaccKind::Original(#action_kind)) | ||
| quote!(::cfgrammar::yacc::YaccKind::Original(#action_kind,)) |
There was a problem hiding this comment.
I think perhaps it is best to attempt to do something less fragile here.
My thoughts are instead of emitting the cache module,
emit a constant string in the hopes that the pretty printer will ignore the string.
E.g. so go from // CACHE INFORMATION ... to const CACHE_INFORMATION: &str = "..."
abandoning cache_module unless we do want to keep it?
There was a problem hiding this comment.
Fixed by 8e32c81 and subsequent commits...
|
Might want to sqaush out the a08fbdb change? |
lrpar/src/lib/ctbuilder.rs
Outdated
| quote! { | ||
| let cache_info = quote! { | ||
| #[allow(unused)] | ||
| mod _cache_information_ { |
There was a problem hiding this comment.
We may want to do something else here, as we no longer actually compile this code
as we change it it could perhaps start to contain syntax errors, etc.
We could emit both the cache_info module, and the module text within that constant string.
Or we could just emit a formatted string more like the original comment.
There was a problem hiding this comment.
Don't we just want to output the information in one place? Perhaps I've misunderstood!
There was a problem hiding this comment.
Yeah, I guess i'm saying:
this emits a strong:
const CACHE_INFO: &str = "#[allow(unused)] mod _cache_information_ {...
But because we never actually compile mod _cache_information_ anymore, it is just embedded in that string,
so it is both confusing, and we could make a change that would cause mod _cache_information_ to not actually compile but not notice.
I basically just did the minimal change to check that embedding it as a string works as a proof of concept.
|
Shouldn't we remove |
lrpar/src/lib/ctbuilder.rs
Outdated
| // This declaration can be affected by the pretty printer. | ||
| // But we would hope the actual cache string is not. | ||
| #[allow(unused)] | ||
| const CACHE_INFO: &str = #cache; |
There was a problem hiding this comment.
Looks like we can name this const _: &str = #cache.
I thought this wasn't a valid constant declaration, but it looks like it is now.
Edit it was allowed in: RFC 2562
There was a problem hiding this comment.
Also allows us to get rid of #[allow(unused)]
|
So, I think this is much less fragile now than trying to rely on the whitespace hack. |
|
Please squash. |
This ran into a known cargo footgun where if you emit rerun-if-changed you are responsible for emitting all the rerun-if-changed directives that otherwise would be implied by cargo.
The cache check only runs if the output grammar is newer.
3b860ca to
5565880
Compare
|
Squashed. |
|
Sorry, I really need to figure out how to configure my editor so it can conditionally automatically run rustfmt or not depending upon which directory I'm editing. Because I have some projects that don't use it. Will need a squash |
|
Please squash. |
This should make the cache more robust to changes that are caused by the pretty printer.
24b77a2 to
93028a5
Compare
|
Squashed. |
I think this should run the cache check,
E.g. at least the following subset of
.buildbot.shnow caught a bug where the pretty printerwas emitting a non-whitespace change, and we had to add a comma.